package top.zhimingw.tankgame3;

import java.util.Vector;

/**
 * @Author:zhimingw
 * @Version 1.0
 * 自己的坦克
 */
public class Hero extends Tank {
    //定义一个Shot对象，表示一个射击
    Vector<Shot> shots = new Vector<>();
    Shot shot = null;
    public Hero(int x,int y){
        super(x,y);
    }

    //射击
    public void shotEnemyTank(){
        if(shots.size()==10)
            return;

        switch (getDirect()){
            case 0:
                shot = new Shot(getX()+20,getY(),0);
                break;
            case 1:
                shot = new Shot(getX()+60,getY()+20,1);
                break;
            case 2:
                shot = new Shot(getX()+20,getY()+60,2);
                break;
            case 3:
                shot = new Shot(getX(),getY()+20,3);
                break;
        }
        shots.add(shot);

        new Thread(shot).start();
    }
}
